package junit;

import java.util.UUID;

import javax.annotation.Resource;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;

import org.junit.Test;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;

@ContextConfiguration({ "classpath:spring-jms.xml" })
public class TestSomeService extends AbstractJUnit4SpringContextTests {
	@Resource
	private JmsTemplate jmsTempalte;

	@Test
	public void test() {
		jmsTempalte.send(new MessageCreator() {
			public Message createMessage(Session session) throws JMSException {
				return session.createTextMessage(UUID.randomUUID().toString());
			}
		});
	}
}
